// 用户模块 Store
export default {
  // 开启模块的命名空间
  // namespaced: true,

  state: {
    userInfo: {
      name: 'zs',
      age: 18
    }
  },
  getters: {
    doubleCount: () => 'user',
    doubleAge: state => state.userInfo.age * 2
  },
  mutations: {
    setAge (state, newAge) {
      console.log('user子模块的setAge')
      state.userInfo.age = newAge
    }
  },
  actions: {
    asyncSetAge (context, newAge) {
      setTimeout(() => {
        context.commit('setAge', newAge)
      }, 1000)
    }
  }
}
